package dao.hibernate;

import java.io.Serializable;
import java.util.List;

import first.guodao.annotation.DaoType;
import first.guodao.annotation.Methodtype;

/**
 * 支持Hbiernate实体维护 MiniDao自动生成SQL
 * 
 * @param po
 */
public interface SupportHiber<T> {
	@Methodtype(value = DaoType.Hibernate, methodname = MiniDaoConstants.METHOD_SAVE)
	void save(T entity);

	@Methodtype(value = DaoType.Hibernate, methodname = MiniDaoConstants.METHOD_SELECT)
	<T> T getById(Class<T> entityClass, final Serializable id);

	@Methodtype(value = DaoType.Hibernate, methodname = MiniDaoConstants.METHOD_SELECT)
	<T> T getByEntity(T entity);

	@Methodtype(value = DaoType.Hibernate, methodname = MiniDaoConstants.METHOD_UPDATE)
	void update(T entity);

	@Methodtype(value = DaoType.Hibernate, methodname = MiniDaoConstants.METHOD_DELETE)
	void delete(T entity);

	@Methodtype(value = DaoType.Hibernate, methodname = MiniDaoConstants.METHOD_SELECT)
	List<T> list(T entity);

	@Methodtype(value = DaoType.Hibernate, methodname = MiniDaoConstants.METHOD_DELETE_BY_ID)
	public <T> void deleteById(Class entityName, Serializable id);
}
